<html>
<head><meta charset="utf-8"><title>Undef enum discriminant · t-compiler/const-eval · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/index.html">t-compiler/const-eval</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html">Undef enum discriminant</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="136921483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136921483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136921483">(Nov 01 2018 at 13:34)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@Oli</span> any idea why this does not error in validation? <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2015&amp;gist=be20fc6e56ea2fec2ebd34eb375b5bd9" target="_blank" title="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2015&amp;gist=be20fc6e56ea2fec2ebd34eb375b5bd9">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2015&amp;gist=be20fc6e56ea2fec2ebd34eb375b5bd9</a></p>



<a name="136921589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136921589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136921589">(Nov 01 2018 at 13:36)</a>:</h4>
<p>uh... does playground nightly contain my query-PR already?</p>



<a name="136921627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136921627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136921627">(Nov 01 2018 at 13:37)</a>:</h4>
<p>I get the same locally. discovered it while working on that visitor PR.</p>



<a name="136921641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136921641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136921641">(Nov 01 2018 at 13:37)</a>:</h4>
<p>oh</p>



<a name="136921662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136921662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136921662">(Nov 01 2018 at 13:38)</a>:</h4>
<p>it's not a validation error</p>



<a name="136921688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136921688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136921688">(Nov 01 2018 at 13:38)</a>:</h4>
<p>it's a regular const eval error</p>



<a name="136921699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136921699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136921699">(Nov 01 2018 at 13:38)</a>:</h4>
<p>because of <code>Scalar</code> layout</p>



<a name="136921701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136921701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136921701">(Nov 01 2018 at 13:38)</a>:</h4>
<p>yes. but validation should complain as well.</p>



<a name="136921709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136921709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136921709">(Nov 01 2018 at 13:38)</a>:</h4>
<p>no, validation is never reached</p>



<a name="136921713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136921713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136921713">(Nov 01 2018 at 13:38)</a>:</h4>
<p>we bail out before we get to validation</p>



<a name="136921726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136921726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136921726">(Nov 01 2018 at 13:39)</a>:</h4>
<p>oh?</p>



<a name="136921743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136921743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136921743">(Nov 01 2018 at 13:39)</a>:</h4>
<p>ah because we cannot create a <code>ConstValue</code></p>



<a name="136921748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136921748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136921748">(Nov 01 2018 at 13:39)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/const_eval.rs#L588" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/const_eval.rs#L588">https://github.com/rust-lang/rust/blob/master/src/librustc_mir/const_eval.rs#L588</a></p>



<a name="136921751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136921751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136921751">(Nov 01 2018 at 13:39)</a>:</h4>
<p>that's so odd that that makes it less hard of an error...</p>



<a name="136921752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136921752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136921752">(Nov 01 2018 at 13:39)</a>:</h4>
<p><code>and_then</code> only enters if it's <code>Ok</code></p>



<a name="136921759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136921759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136921759">(Nov 01 2018 at 13:39)</a>:</h4>
<p>yea <span class="emoji emoji-1f641" title="frown">:frown:</span></p>



<a name="136921807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136921807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136921807">(Nov 01 2018 at 13:40)</a>:</h4>
<p>maybe we can push that back and do the conversion to <code>ConstValue</code> after validation?</p>



<a name="136922033"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136922033" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136922033">(Nov 01 2018 at 13:44)</a>:</h4>
<p>so, letting <code>const_eval_raw</code> always return an allocation and doing the conversion later? seems reasonable.</p>



<a name="136953810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Undef%20enum%20discriminant/near/136953810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Undef.20enum.20discriminant.html#136953810">(Nov 01 2018 at 22:12)</a>:</h4>
<blockquote>
<p>playground nightly contain</p>
</blockquote>
<p>The version of both nightly and miri are in their respective menus, BTW</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>